FSM with logic bricks 1 phase 0
=Phase 0 - Preparation= General This tutorial will not describe how to produce characters, meshes or animations. There are enough tutorials around to teach you this skills. You might find some tipps and tricks here. The purpose of this tutorial is to show you how to make the logic brick do what you want. Therefore it is important to know what you want. Even with this simple example in this tutorial you can see that changing your goals can invalidate all your previous work. So lets start with the goals. Goals *Have a character that can do following things: :*Standing around (with a little motion that it looks alive). :*Starts walking on user interaction. :*Picking up a ball on user interaction. :*After picking up the ball standing around while holding the ball. :*Walk with the ball on user action. :*Dropping the ball on user action. :*Staying around after dropping the ball *The animations should be smooth blend together without "jumps". *The ball should look like taken by the character and dropped to the ground. That are the goals after all phases are completed. Not everything is described in the goals. It looks more like general ideas. At least this goals should be achived when we are finished. Lets be a bit more specific when defining the User Interaction We will only use keyboard input: Objects What do we need? The Character The character consist of an armature (skeleton) with bones. To the armature the characters skin is attached (in armature mode). The skin should contain vertex groups according to the bones name. The armature requires some actions (animations). The required actions can be found in the section Actions. The character of this tutorial is based on the "Blender Documentation Volume I". look for "Your first animation in 30 + 30 minutes". It teaches you to create a character named GUS. As an alternative you can use an own character. If you do not have a character or you do not want to follow the above tutorial you can download GUS at the end of this page. The Ball The ball can be picked up. It is just the default ICO-Sphere with a simple texture. Build your own or load it together with GUS at the end of this page. But wait. We can't change parents during the game. Also parent-to-bone does not work. There is a trick. We will need 3 balls looking exactly the same: :*ball_floor - resting on the floor. :*ball_GUS - GUS us holding the ball with his right arm. :*ball_drop - the falling ball. Each of them has an IPO curve. See section IPOs for details. The Environment Is just a plane representing the ground. No animation required. Animation Actions Here is a list of actions and what they should do: The walking and standing animations require blending (5 frames) to make a smooth transition between them. As an alternative the animations stand-to-walk and walk-to-stand would be required (with and without the ball). IPOs ball_floor Keys: 0 - invisible, 1 - visible. This object needs a possibility to hide itself. There are several methods. My method is to scale the object down to 0. Add a scale IPO key at frame 0 when the object is hidden. Add a scale IPO key at frame 1 when the object is present. Call the IPO curve "Scale_0". Alternatives: *move it under the floor. *use the visibility actuator ball_GUS Keys: 0 - invisible, 1 - visible. This object needs the same IPO curve as ball_floor. *Go to the IPO curve editor. *Select ball_GUS. *Select the IPO curve "Scale_0" from above. The pickup, hold and drop animations are performed by the armature actions as ball_GUS is parented to the armature. ball_drop Keys: 0 - invisible, 1 - visible at release position, 101 - visible at rest position This one is not that simple. The ball must perform a falling animation from the point where GUS releases the ball until the position where the ball rests on the ground. The start and end points are given by ball_GUS and Ball_floor. To make it look natural I decided to temporarily make the ball_drop an actor and record the IPO when it is falling. Here is how I did that: * Duplicate the ball_floor to ball_floor.001. * Let the armature perform the pickup action in pose mode (GUS_ball_pickup). * Go to the frame where GUS graps the ball (21). * Parent ball_floor.001 to the bone Arm.R (parent-to-bone). * Select the dropping action (GUS_ball_dropping). * Go to the frame where GUS releases the ball (41). * Unparent ball_floor.001 but keep the transformation. The ball should not change the location/rotation. * Copy the location/rotation to the ball_drop (hint: select ball_drop; shift select ball_floor.001; <^c>; location; <^c> rotation) * Remove ball_floor.001 or move it to a hidden layer. * Now we have the initial position. Add the location/rotation IPO key with *Ensure you have a ground plane *Make ball_drop to a rigid actor. *Start the Gameengine and look how the ball falls. *Adjust the material settings until ou are happy with the animation. *Make sure the ball will stay near the ball_floor. *Switch on Game/Record game Physics to IPO. *Run the game engine until the Ball stays still. *Switch off Game/Record game Physics to IPO. *Disle actor on ball_drop. *Go to the IPO window of ball_drop. *Call the IPO curve "ball_drop". *Determine an end frame when the falling is finished (e.g. 101). *Adjust the IPO curve to reduce the number of keys. Only LocZ curve should be relevant. Remove all other curves. This saves a lot of disc space. *Go to the first frame add location and rotation IPO keys. *The ball is likely not at the same position (rotation as the ball_floor. Therefore go to the last frame (101). *Copy the location and rotation from ball_floor. Add the IPO keys at the animation end. *If necessary adjust the IPO curves to make the fall look natural. To hide the object we need the same scale IPO curves as ball_floor. This time they needs to be copied to the existing curves. You can do this with the buffer. Sample download Download GUS, balls and animations from Polorix It is the final blend file just without the logic bricks. Back